package concurrency.chapter10;

import concurrency.chapter5.ThreadJoin3;

public class SynchronizedProblem {
    public static void main(String[] args) throws InterruptedException {
        new Thread() {
            @Override
            public void run() {
                SynchronizedProblem.run();
            }
        }.start();
        Thread.sleep(1_000);
        Thread t2 = new Thread() {
            @Override
            public void run() {
                SynchronizedProblem.run();
            }
        };
        t2.start();
        Thread.sleep(2000);
        t2.interrupt();
        //打断了t1 但是t1没有释放锁
        System.out.println(t2.isInterrupted());
    }

    private synchronized static void run() {
        System.out.println(Thread.currentThread().getName());
        while (true) {


        }
    }
}
